Skip to content
  • 0 Votes
    3 Posts
    400 Views
    HowardHarknessH

    @timob256 First of all, I recommend against using protected mode. It is a subtle violation of the Liskov Substitution Principle that will bite you (or whomever gets stuck with the maintenance of this code).

    The immediate cure is to add an accessor in the public section of class wgt_screen:

    public: ... texnStructur getMyTexpr() {return _myTexpr;} ...

    Then, wherever you use_myTexpr.[fieldname] in the main window, use getMyTexpr().[fieldname] instead.

    Example:
    if(wgt->_myTexpr.outline)
    would become
    if(wgt->getMyTexpr().outline)

  • Trying to create a simple subclass

    Unsolved C++ Gurus
    3
    0 Votes
    3 Posts
    437 Views
    JonBJ

    @J-Hilk said in Trying to create a simple subclass:

    try deleting your shadow build project, maybe old build artifacts cause problems here

    @ffej2ffej
    As @J-Hilk says. It should not be like this, but it's a nasty lesson to learn with Qt building in practice: whenever you get an "inexplicable" compile/link message and you are "sure" your code is correct, start by deleting all the contents of the build output directory and rebuild from scratch, before puzzling further. This applies particularly when you have made a change in a header file to do with classes inheriting from QObject/changing whether they have Q_OBJECT macro, and similar....